<!DOCTYPE html>
<html>
<head>
<title>加息券规则管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<#include "../../../../include/resources.html">

<script type="text/javascript">
	var dataGrid;
	var winWidth =  700; //弹出窗口宽度
	var winHeight = 500; //弹出窗口高度
	var addTitle = "添加规则"; //添加窗口标题
	var addUrl =  "/modules/additional/upRate/append.html"; // 添加窗口链接地址
	var editTitle = "编辑规则"; //编辑窗口标题
	var editUrl =  "/modules/additional/upRate/modify.html"; //编辑窗口链接地址
	var disableUrl = "/modules/additional/upRate/disable.html"; //禁用窗口链接地址
	var enableUrl = "/modules/additional/upRate/enable.html"; //启用窗口链接地址
	
	var detailTitle="查看详情";// 查看详情
	var detailUrl = "/modules/additional/upRate/ruleDetail.html";
	var txt1 = "禁用";
	var txt2 = "启用";
	var val1 = true;
	var val2 = false;
	
	$(function() {
		dataGrid = $('#dataGrid').datagrid({
			url : 'rateRuleListJson.html',
			fit : true,
			fitColumns : true,
			border : false,
			pagination : true,
			idField : 'id',
			pageSize : pageSize,
			pageNums :1,
			pageList : pageList,
			sortName : 'id',
			sortOrder : 'asc',
			checkOnSelect : false,
			selectOnCheck : false,
			nowrap : false,
			singleSelect:true,
			columns : [ [
			{ field: 'id', title: '编号', width: 50, checkbox : false},
			{ field: 'ruleName', title: '规则名', width: 100, checkbox : false},
			{ field: 'payWay', title: '发放方式', width: 100, checkbox : false,
				formatter: function(value,row,index){
					if (value == 1) {
						return "按固定值";
					} else if (value == 2) {
						return "按投资额度";
					}else if(value == 3){
						return "随机额度";
					} else {
						return "-";
					} 
				}
			},
			{ field: 'upApr', title: '加息额度(%)', width: 80, sortable: false},
			{ field: 'payTotal', title: '预计发放总数', width: 100, sortable: false},
			{ field: 'realPayTotal', title: '实际发放总数', width: 100, sortable: false},
			{ field: 'valitTime', title: '有效期(天)', width: 100, sortable: false},
			{ field: 'isUse', title: '状态', width: 60, sortable: false,
				formatter: function(value,row,index){
					if (value == 1) {
						return "启用";
					} else if (value == 2) {
						return "不启用";
					} else {
						return "-";
					} 
				} 		
			},
			
            {   field : 'action',
                title : '操作',
                width :75,
                fixed: true,
                align:'center',
                formatter : function(value, row, index) { //功能按钮添加
                    var str = '';
                	if (row.isUse==1 || row.isUse==2) {
	                    str += '<dl>';
						str += '<dt><a href="javascript:void(0);" onclick="$.fn.formOptions.viewFun('+row.id+',detailTitle,winWidth,winHeight,detailUrl);" title="'+detailTitle+'">查看</a><i class="iconfont">&#xe639;</i></dt>' ;
						str += '<dd>';
	                    if(row.isUse==2){
	                		str += '<a href="javascript:void(0);" onclick="$.fn.dataGridOptions.editFun('+row.id+',editTitle,winWidth,winHeight,editUrl);" title="'+editTitle+'">编辑</a>';
	                    }
	                    if(row.isUse==1){
							str += '<a href="javascript:void(0);" onclick="$.fn.dataGridOptions.recordOptFun('+row.id+',disableUrl,txt1,val1);">禁用</a>';
						} else if(row.isUse==2){
							str += '<a href="javascript:void(0);" onclick="$.fn.dataGridOptions.recordOptFun('+row.id+',enableUrl,txt2,val2);">启用</a>';
						}
	                    str += '</dd>'
	   					str += '</dl>'
	                }
                	return str;
                }
            },
            
			 ] ],
			toolbar : '#toolbar',
			onLoadSuccess : function() {
				$('#searchForm table').show();
				parent.$.messager.progress('close');
			}
		});
	});
</script>
</head>
<body style="padding:0 20px;" >
	<div class="easyui-layout" data-options="fit : true,border : false">
		<div data-options="region:'north',border:false,collapsible:false" id="searchBox">
        	<#--
        	<div class="sLeft">
	            <form id="searchForm">
	            	<input type="text"  name="searchName" class="sInput" placeholder="输入用户名/真实姓名进行搜索" autocomplete="off" onkeydown="if(event.keyCode == 13){ $.fn.dataGridOptions.searchFun('#searchForm');return false;}"/><a href="javascript:;" title="查询" class="sBtn" onclick="$.fn.dataGridOptions.searchFun('#searchForm');">查询</a>
	            	<a href="javascript:void(0);" class="reloadIcon" onclick="dataGrid.datagrid('reload');" title="刷新" ><i class="iconfont">&#xe603;</i></a>
	            </form>
            </div>
			-->
	        <div class="sRight">
                <a onclick="$.fn.dataGridOptions.addFun(-1,addTitle,winWidth,winHeight,addUrl);" href="javascript:void(0);" class="addBtn"><i class="iconfont">&#xe629;</i>添加加息规则</a>     
            </div>
		</div>
		<div data-options="region:'center'" style="margin-top:30px;padding-bottom:30px;">
			<table id="dataGrid"></table>
		</div>
	</div>
</body>
</html>
<script src="${theme_dir}/js/search.js"></script>